<%--
  Created by IntelliJ IDEA.
  User: 10171225
  Date: 2016/6/23
  Time: 15:28
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html>
<head>
    <base href="<%=basePath%>"/>
    <title>编辑双色球</title>
    <script src="static/javascript/jquery-1.11.3.min.js"></script>
    <script type="text/javascript" language="JavaScript">
        $(document).ready(function(){
            var doubleColorBallId = '${doubleColorBall.id}';
            $("#submit").click(function () {
                var map = {
                    "期号": $("#issue"),
                    "红1": $("#redOne"),
                    "红2": $("#redTwo"),
                    "红3": $("#redThree"),
                    "红4": $("#redFour"),
                    "红5": $("#redFive"),
                    "红6": $("#redSix"),
                    "蓝球": $("#blue"),
                    "开奖日期": $("#drawDate")
                }
                if($.judgeNotNull(map) == false){
                    return false;
                }
                var reg = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/;
                var r = $("#drawDate").val().match(reg);
                if(r==null) {
                    alert("日期格式必须为：'YYYY-MM-DD'这样的形式！");
                }
                $.ajax({
                    type : 'get',
                    contentType:"application/json;charset=utf-8",
                    url : 'admin/doubleColorBallManage/doubleColorBallEditSubmit',
                    dataType : 'json',
                    cache: false,
                    timeout: 5000,
                    async: false,
                    data: {
                        "noticeId": encodeURI(doubleColorBallId),
                        "issue" : encodeURI($("#issue").val()),
                        "redOne" : encodeURI($("#redOne").val()),
                        "redTwo" : encodeURI($("#redTwo").val()),
                        "redThree" : encodeURI($("#redThree").val()),
                        "redFour" : encodeURI($("#redFour").val()),
                        "redFive" : encodeURI($("#redFive").val()),
                        "redSix" : encodeURI($("#redSix").val()),
                        "blue" : encodeURI($("#blue").val()),
                        "drawDate" : encodeURI($("#drawDate").val()),
                        "currentPrizePool" : encodeURI($("#currentPrizePool").val()),
                        "prizeInfo" : encodeURI($("#prizeInfo").val())
                    },
                    success: function(result){
                        alert(result);
                        $("#doubleColorBallManage").click();
                    },
                    error: function(XMLHttpRequest, textStatus, errorThrown) {
                        alert("ajax异常，请联系管理员！");
                    }
                });
            });
        });
    </script>
</head>
<body>
<table>
    <tr><td>期号</td><td><input type="text" id="issue" value="${doubleColorBall.issue}"/></td></tr>
    <tr><td>红1</td><td><input type="text" id="redOne" value="${doubleColorBall.redOne}"/></td></tr>
    <tr><td>红2</td><td><input type="text" id="redTwo" value="${doubleColorBall.redTwo}"/></td></tr>
    <tr><td>红3</td><td><input type="text" id="redThree" value="${doubleColorBall.redThree}"/></td></tr>
    <tr><td>红4</td><td><input type="text" id="redFour" value="${doubleColorBall.redFour}"/></td></tr>
    <tr><td>红5</td><td><input type="text" id="redFive" value="${doubleColorBall.redFive}"/></td></tr>
    <tr><td>红6</td><td><input type="text" id="redSix" value="${doubleColorBall.redSix}"/></td></tr>
    <tr><td>蓝球</td><td><input type="text" id="blue" value="${doubleColorBall.blue}"/></td></tr>
    <tr><td>开奖日期</td><td><input type="text" id="drawDate" value="${doubleColorBall.drawDate}"/></td></tr>
    <tr><td>奖金池</td><td><input type="text" id="currentPrizePool" value="${doubleColorBall.currentPrizePool}"/></td></tr>
    <tr><td>中奖信息</td><td><input type="text" id="prizeInfo" value="${doubleColorBall.prizeInfo}"/></td></tr>
    <tr><td></td><td><button id="submit" value="修改提交"></button></td></tr>
</table>

</body>
</html>